package com.wasion.gydpe.ice;

import nl.justobjects.pushlet.test.PushletPingApplication;
import CommProxy.CBasicParameter;
import CommProxy.InstructionFrame;

public class ReceiveMessage implements CCustomReceiver {
	public InstructionFrame _frame;

	public int recv(CBasicParameter frame) {

		String pushlet_port = "";
		String pushlet_ip = "";
		int port = 8080;
		TestProperties ec = TestProperties.getInstance();
		if (ec != null) {
			pushlet_port = ec.getPropertyValue("/IceComm.properties",
					"Pushlet.Port");
			pushlet_ip = ec.getPropertyValue("/IceComm.properties",
					"Pushlet.Ip");
			if (!pushlet_port.equals("")) {
				port = Integer.parseInt(pushlet_port);
			}

		}

		// 对不同数据进行处理,根据传过来的seqid
		/**
		 * String _receiver = frame.receiver; //
		 * System.out.println("receiver:"+_receiver);
		 * 
		 * String _sender = frame.sender;
		 * 
		 * int _seqID = frame.seqID;
		 * 
		 * boolean _isResponse = frame.isResponse;
		 * 
		 * boolean _isWait = frame.isWait; // instruction frame.
		 * InstructionFrame frame2 = (InstructionFrame) frame; String _tele =
		 * frame2.frame.tele;
		 * 
		 * int _afn = frame2.frame.afn;
		 * 
		 * int _ertuAddr = frame2.frame.ertuAddr;
		 * 
		 * int _subErtuAddr = frame2.frame.subErtuAddr;
		 * 
		 * int _commMode = frame2.frame.commMode;
		 * 
		 * int _protocol = frame2.frame.protocol; // instruction 的数据 byte[] data =
		 * frame2.frame.data;
		 */
		new PushletPingApplication(pushlet_ip, port, frame).start();

		return 1;
	}

}
